const fs = require('fs')

const readData = (dir) => {
  let data = fs.readFileSync(dir, 'utf-8')
  data = JSON.parse(data)
  return data
}

const wirteData = (dir, data) => {
  const jsonData = JSON.stringify(data, null, 2)
  fs.writeFileSync(dir, jsonData)
}

module.exports = {
  readData,
  wirteData
}